home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / xml / gnome / xslt / docbook / html / db2html-xref.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2009-03-17  |  5.4 KB  |  160 lines

  1. <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
  2. <!--
  3. This program is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU Lesser General Public License as published by the Free
  5. Software Foundation; either version 2 of the License, or (at your option) any
  6. later version.
  7.  
  8. This program is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  11. details.
  12.  
  13. You should have received a copy of the GNU Lesser General Public License
  14. along with this program; see the file COPYING.LGPL.  If not, write to the
  15. Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  16. 02111-1307, USA.
  17. -->
  18.  
  19. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  20.                 xmlns="http://www.w3.org/1999/xhtml"
  21.                 version="1.0">
  22.  
  23. <!--!!==========================================================================
  24. DocBook to HTML - Links and Cross References
  25. :Requires: db-xref
  26.  
  27. REMARK: Describe this module
  28. -->
  29.  
  30.  
  31. <!--**==========================================================================
  32. db2html.anchor
  33. Generates an anchor point for an element
  34. $node: The element to generate an anchor for
  35. $name: The text to use for the #{name} attribute
  36.  
  37. REMARK: Describe this template
  38. -->
  39. <xsl:template name="db2html.anchor" match="anchor">
  40.   <xsl:param name="node" select="."/>
  41.   <xsl:param name="name" select="$node/@id"/>
  42.   <xsl:if test="$name"><a name="{$name}"/></xsl:if>
  43. </xsl:template>
  44.  
  45.  
  46. <!--**==========================================================================
  47. db2html.link
  48. Generates a hyperlink from a #{link} element
  49. $linkend: The id of the element being linked to
  50. $target: The element being linked to
  51.  
  52. REMARK: Describe this template
  53. -->
  54. <xsl:template name="db2html.link" match="link">
  55.   <xsl:param name="linkend" select="@linkend"/>
  56.   <xsl:param name="target" select="key('idkey', $linkend)"/>
  57.   <a class="link">
  58.     <xsl:attribute name="href">
  59.       <xsl:call-template name="db.xref.target">
  60.         <xsl:with-param name="linkend" select="$linkend"/>
  61.       </xsl:call-template>
  62.     </xsl:attribute>
  63.     <xsl:attribute name="title">
  64.       <xsl:call-template name="db.xref.tooltip">
  65.         <xsl:with-param name="linkend" select="$linkend"/>
  66.         <xsl:with-param name="target" select="$target"/>
  67.       </xsl:call-template>
  68.     </xsl:attribute>
  69.     <xsl:choose>
  70.       <xsl:when test="normalize-space(.) != ''">
  71.         <xsl:apply-templates/>
  72.       </xsl:when>
  73.       <xsl:when test="@endterm">
  74.         <xsl:apply-templates select="key('idkey', @endterm)/node()"/>
  75.       </xsl:when>
  76.     </xsl:choose>
  77.   </a>
  78. </xsl:template>
  79.  
  80.  
  81. <!--**==========================================================================
  82. db2html.ulink
  83. Generates a hyperlink from a #{ulink} element
  84. $url: The URL to link to
  85. $content: Optional content to use for the text of the link
  86.  
  87. REMARK: Describe this template
  88. -->
  89. <xsl:template name="db2html.ulink" match="ulink">
  90.   <xsl:param name="url" select="@url"/>
  91.   <xsl:param name="content" select="false()"/>
  92.   <a class="ulink" href="{$url}">
  93.     <xsl:attribute name="title">
  94.       <xsl:call-template name="db.ulink.tooltip"/>
  95.     </xsl:attribute>
  96.     <xsl:choose>
  97.       <xsl:when test="$content">
  98.         <xsl:copy-of select="$content"/>
  99.       </xsl:when>
  100.       <xsl:when test="string-length(normalize-space(node())) != 0">
  101.         <xsl:apply-templates/>
  102.       </xsl:when>
  103.       <xsl:otherwise>
  104.         <xsl:value-of select="$url"/>
  105.       </xsl:otherwise>
  106.     </xsl:choose>
  107.   </a>
  108. </xsl:template>
  109.  
  110.  
  111. <!--**==========================================================================
  112. db2html.xref
  113. Generates a hyperlink from an #{xref} element
  114. $linkend: The id of the element being linked to
  115. $target: The element being linked to
  116. $endterm: The id of an element whose contents will be used for the link text
  117. $xrefstyle: The style of cross reference text to use
  118. $content: Optional content to use for the text of the link
  119.  
  120. REMARK: Describe this template
  121. -->
  122. <xsl:template name="db2html.xref" match="xref">
  123.   <xsl:param name="linkend"   select="@linkend"/>
  124.   <xsl:param name="target"    select="key('idkey', $linkend)"/>
  125.   <xsl:param name="endterm"   select="@endterm"/>
  126.   <xsl:param name="xrefstyle" select="@xrefstyle"/>
  127.   <xsl:param name="content"   select="false()"/>
  128.   <a class="xref">
  129.     <xsl:attribute name="href">
  130.       <xsl:call-template name="db.xref.target">
  131.         <xsl:with-param name="linkend" select="$linkend"/>
  132.         <xsl:with-param name="target" select="$target"/>
  133.       </xsl:call-template>
  134.     </xsl:attribute>
  135.     <xsl:attribute name="title">
  136.       <xsl:call-template name="db.xref.tooltip">
  137.         <xsl:with-param name="linkend" select="$linkend"/>
  138.         <xsl:with-param name="target" select="$target"/>
  139.       </xsl:call-template>
  140.     </xsl:attribute>
  141.     <xsl:choose>
  142.       <xsl:when test="$content">
  143.         <xsl:copy-of select="$content"/>
  144.       </xsl:when>
  145.       <xsl:when test="$endterm">
  146.         <xsl:apply-templates select="key('idkey', $endterm)/node()"/>
  147.       </xsl:when>
  148.       <xsl:otherwise>
  149.         <xsl:call-template name="db.xref.content">
  150.           <xsl:with-param name="linkend" select="$linkend"/>
  151.           <xsl:with-param name="target" select="$target"/>
  152.           <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
  153.         </xsl:call-template>
  154.       </xsl:otherwise>
  155.     </xsl:choose>
  156.   </a>
  157. </xsl:template>
  158.  
  159. </xsl:stylesheet>
  160.